Conversation
There was a problem hiding this comment.
Pull request overview
This PR adds Dev Tunnels–based remote connectivity for debugger (DAP) jobs by extending the job message contract with tunnel details and updating the worker-side debugger startup to bind to the tunnel-provided port and start a tunnel relay.
Changes:
- Extend
AgentJobRequestMessagewithDebuggerTunnelpayload deserialization (tunnel ID/cluster/token/port) and add theDebuggerTunnelInfocontract type. - Replace
GlobalContext.EnableDebuggerwith a consolidatedDebuggerConfig(enabled + tunnel info) and update debugger enablement checks accordingly. - Update
DapDebuggerto require a valid tunnel config, bind to the tunnel port, and start/stop a Dev Tunnel relay; adjust L0 tests to use the new config model.
Reviewed changes
Copilot reviewed 10 out of 10 changed files in this pull request and generated 5 comments.
Show a summary per file
| File | Description |
|---|---|
| src/Test/L0/Worker/DapDebuggerL0.cs | Updates L0 tests to use tunnel-based debugger config and skips relay during unit tests. |
| src/Test/L0/Sdk/RSWebApi/AgentJobRequestMessageL0.cs | Adds deserialization tests for the new DebuggerTunnel payload. |
| src/Sdk/DTPipelines/Pipelines/DebuggerTunnelInfo.cs | Introduces the tunnel info DataContract used in job messages. |
| src/Sdk/DTPipelines/Pipelines/AgentJobRequestMessage.cs | Adds DebuggerTunnel DataMember to the job request message. |
| src/Runner.Worker/Runner.Worker.csproj | Adds Microsoft.DevTunnels.Connections dependency for relay hosting. |
| src/Runner.Worker/JobRunner.cs | Switches debugger enablement check to Global.Debugger?.Enabled. |
| src/Runner.Worker/GlobalContext.cs | Replaces EnableDebugger with DebuggerConfig Debugger. |
| src/Runner.Worker/ExecutionContext.cs | Populates Global.Debugger from EnableDebugger + DebuggerTunnel in the acquire response. |
| src/Runner.Worker/Dap/DebuggerConfig.cs | Adds consolidated debugger configuration and tunnel validity check. |
| src/Runner.Worker/Dap/DapDebugger.cs | Requires valid tunnel config, binds to tunnel port, and starts/stops Dev Tunnel relay. |
| /// Useful when third-party libraries require a <see cref="System.Diagnostics.TraceSource"/> | ||
| /// to route their diagnostics into the runner's log infrastructure. | ||
| /// </summary> | ||
| public TraceSource Source => _traceSource; |
There was a problem hiding this comment.
does this work? are we able to get log from the AzureSDK into the runner diag log?
| }; | ||
|
|
||
| _tunnelRelayHost = new TunnelRelayTunnelHost(managementClient, HostContext.GetTrace("DevTunnelRelay").Source); | ||
| using var connectCts = new CancellationTokenSource(TimeSpan.FromSeconds(30)); |
There was a problem hiding this comment.
is the 30s good enough? do we need to make this configureable in case the tunnel connection is flaky?
ignore this comment if we know the connect is super reliable and the P99.9 is less than 5s. 😄
| Trace.Info("Dev Tunnel relay stopped"); | ||
| } | ||
| } | ||
| catch (Exception ex) |
There was a problem hiding this comment.
why we need the catch, what code might throw?
| HandleClientDisconnected(); | ||
| CleanupConnection(); | ||
| } | ||
| catch (ObjectDisposedException) |
There was a problem hiding this comment.
if we are catching ObjectDisposedException, we might have something doing wrong since we shouldn't dispose an object if we are stilling using it somewhere else, dispose should be the last thing to call when everything has stopped.
| && !string.IsNullOrEmpty(Tunnel.TunnelId) | ||
| && !string.IsNullOrEmpty(Tunnel.ClusterId) | ||
| && !string.IsNullOrEmpty(Tunnel.HostToken) | ||
| && Tunnel.Port >= 1024; |
This PR adds remote debugger connectivity to the runner via Dev Tunnels. The runner now deserializes the DebuggerTunnel payload (tunnel ID, cluster, host token, port) from the job message, binds the DAP server to the tunnel-provided port, and starts a Dev Tunnel relay so remote DAP clients can connect. The DAP port is now mandated by the backend for two reasons:
Since we're adding more debugger configuration this also changes the previous
EnableDebuggerbool in context with an object carrying that configuration.https://github.com/github/c2c-actions/issues/9831